home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
5 Star Games: DOS Edition 2
/
5 Star Games - DOS Edition (1995)(Ready to Run).iso
/
dbc
/
db_uwin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-28
|
25KB
|
422 lines
/****************************************************************************/
/* DATABOSS MODULE: DB_UWIN.C */
/****************************************************************************/
#include "db_lsc.h"
#ifdef __TURBOC__
#include <conio.h>
#include "db_types.h"
#else
#include <graph.h>
#include "db_types.h"
#include "db_conio.h"
#endif
#include <dos.h>
#include <io.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "db_curs.h"
#include "db_dos.h"
#include "db_file.h"
#include "db_key.h"
#include "db_str.h"
#include "db_funcs.h"
#include "db_sets.h"
#include "db_win.h"
#include "db_uwin.h"
/*************************** INTERNAL VARIABLES ***************************/
justified just;
static bool initialized = False;
/***************************** IMPLEMENTATION *****************************/
winptr ColorPaletteWin(void)
/* Draw the Color Palette Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,17,7,48,8,31,30,8,"─┐│┘─└│┌",TopLft,"┤ Color Palette ├")) {
twinp = curwin;
writewxy(" Low High Dec = ",0,1,1,twinp);
writewxy(" ┌────────────────┐ ",0,1,2,twinp);
writewxy(" Foreground --> ████████████████ ┌┬┬┬┬┬┬┬┬┬┬┬┐ ",0,1,3,twinp);
writewxy(" │├┼┼┼┼┼┼┼┼┼┤│ ",0,1,4,twinp);
writewxy(" │├┼┼┼┼┼┼┼┼┼┤│ ",0,1,5,twinp);
writewxy(" Background --> ■■■■■■■■ └┴┴┴┴┴┴┴┴┴┴┴┘ ",0,1,6,twinp);
writewxy(" └────────────────┘ ",0,1,7,twinp);
writewxy(" Normal Blink Hex = ",0,1,8,twinp);
attrwritewxy(1,16,17,3,twinp); attrwritewxy(1,1,18,3,twinp);
attrwritewxy(1,2,19,3,twinp); attrwritewxy(1,3,20,3,twinp);
attrwritewxy(1,4,21,3,twinp); attrwritewxy(1,5,22,3,twinp);
attrwritewxy(1,6,23,3,twinp); attrwritewxy(1,7,24,3,twinp);
attrwritewxy(1,8,25,3,twinp); attrwritewxy(1,9,26,3,twinp);
attrwritewxy(1,10,27,3,twinp); attrwritewxy(1,11,28,3,twinp);
attrwritewxy(1,12,29,3,twinp); attrwritewxy(1,13,30,3,twinp);
attrwritewxy(1,14,31,3,twinp); attrwritewxy(1,15,32,3,twinp);
attrwritewxy(1,15,17,6,twinp); attrwritewxy(1,47,19,6,twinp);
attrwritewxy(1,63,20,6,twinp); attrwritewxy(1,79,21,6,twinp);
attrwritewxy(1,95,22,6,twinp); attrwritewxy(1,111,23,6,twinp);
attrwritewxy(1,127,24,6,twinp); attrwritewxy(1,143,25,6,twinp);
attrwritewxy(1,159,26,6,twinp); attrwritewxy(1,175,27,6,twinp);
attrwritewxy(1,191,28,6,twinp); attrwritewxy(1,207,29,6,twinp);
attrwritewxy(1,223,30,6,twinp); attrwritewxy(1,239,31,6,twinp);
attrwritewxy(1,255,32,6,twinp);
}
return(twinp);
}
winptr ColorPaletteHelp(void)
/* Draw the Color Palette Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,12,16,58,6,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Color Palette ├")) {
twinp = curwin;
writewxy(" Use the cursor Up, and Down keys to toggle between the ",0,1,1,twinp);
writewxy(" Foregroung, and Background attribute bars; then use the ",0,1,2,twinp);
writewxy(" Cursor Left, and Right keys to select the desired color ",0,1,3,twinp);
writewxy(" combination. ",0,1,4,twinp);
writewxy(" When you have the selected the desired combination press ",0,1,5,twinp);
writewxy(" <Enter>. Press <Esc> to abort. ",0,1,6,twinp);
}
return(twinp);
}
winptr PickChHelp(void)
/* Draw the Pick Ascii Character Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,12,17,57,4,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Pick Character ├")) {
twinp = curwin;
writewxy(" Use the cursor arrow keys to move the cursor block over ",0,1,1,twinp);
writewxy(" the character you desire, then press the <Enter> key. ",0,1,2,twinp);
writewxy(" You may also select any character from the standard ",0,1,3,twinp);
writewxy(" keyboard by pressing that key. Press <Esc> to Abort. ",0,1,4,twinp);
}
return(twinp);
}
winptr DirPickHelp(void)
/* Draw the Pick FileName Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,6,14,71,9,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Directory of Files ├")) {
twinp = curwin;
writewxy(" Use the cursor \x18\x19\x1A\x1B keys to move the highlight bar over the name ",0,1,1,twinp);
writewxy(" of the file you desire, then press <Enter>. The PgDn and PgUp keys ",0,1,2,twinp);
writewxy(" will go to other pages, (if they exist). ",0,1,3,twinp);
writewxy(" ",0,1,4,twinp);
writewxy(" If you select a 'Directory', (indicated by the trailing '\\') then ",0,1,5,twinp);
writewxy(" the files from that directory will be displayed. To select files ",0,1,6,twinp);
writewxy(" from another DRIVE simultaneously press 'Ctrl' + <Drive Letter>. ",0,1,7,twinp);
writewxy(" ",0,1,8,twinp);
writewxy(" Press Esc to remove this help window from the screen. ",0,1,9,twinp);
}
return(twinp);
}
winptr BoxChHelp(void)
/* Draw the Select Box Character Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,9,18,66,2,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Box Characters ├")) {
twinp = curwin;
writewxy(" Use the cursor left, and right arrow keys to highlight the box ",0,1,1,twinp);
writewxy(" character you desire, then press <Enter>. Press <Esc> to abort. ",0,1,2,twinp);
}
return(twinp);
}
winptr OnLineManualHelp(void)
/* Draw the On-Line Manual Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,4,9,73,11,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Manual Commands ├")) {
twinp = curwin;
writewxy(" \x18\x19 ..................... Scroll Up and Down. ",0,1,1,twinp);
writewxy(" Home, End ............... Go to the Top and Bottom of the current page. ",0,1,2,twinp);
writewxy(" PgDn, PgUp .............. Go to the Next and Previous Page. ",0,1,3,twinp);
writewxy(" Ctrl PgDn, Ctrl PgUp .... Go to the Next and Previous Chapter. ",0,1,4,twinp);
writewxy(" Ctrl Home, Ctrl End ..... Go to the First and Last Chapter. ",0,1,5,twinp);
writewxy(" P(n) .................... Enter the Page No. to Jump to. ",0,1,6,twinp);
writewxy(" C(n) .................... Enter the Chapter No. to Jump to. ",0,1,7,twinp);
writewxy(" F8 ...................... Go to the Overview to select a page. ",0,1,8,twinp);
writewxy(" F9 ...................... Go to the Index to select a page. ",0,1,9,twinp);
writewxy(" Ctrl P .................. Print Manual. Print Pages, Chapters, etc. ",0,1,10,twinp);
writewxy(" ESC ..................... Leave the Online Manual. ",0,1,11,twinp);
}
return(twinp);
}
winptr FixFilesWin(void)
/* Draw the Re-Index Module"s Main Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,2,2,78,23,63,62,8,"─┐│┘─└│┌",TopLft,"─ File Recovery ─")) {
twinp = curwin;
writewxy(" This module will enable you to purge all deleted records, and/or rebuild ",0,1,1,twinp);
writewxy(" any damaged index files. You may restrict the recovery process to ",0,1,2,twinp);
writewxy(" specific files if desired. ",0,1,3,twinp);
writewxy(" ",0,1,4,twinp);
writewxy(" NOTE :- Be sure to have at least one backup of your data BEFORE you ",0,1,5,twinp);
writewxy(" continue with this process. You may have to restore the data ",0,1,6,twinp);
writewxy(" files if this process fails. If you do not have any recent ",0,1,7,twinp);
writewxy(" backups of your data files, press ESC and make some now. ",0,1,8,twinp);
writewxy(" ",0,1,9,twinp);
writewxy(" ",0,1,10,twinp);
writewxy(" Selected Files ┌────────────┬────────────┬────────────┬────────────┐ ",0,1,11,twinp);
writewxy(" │ │ │ │ │ ",0,1,12,twinp);
writewxy(" Use \x18\x19\x1A\x1B to move ├────────────┼────────────┼────────────┼────────────┤ ",0,1,13,twinp);
writewxy(" between Files. │ │ │ │ │ ",0,1,14,twinp);
writewxy(" Press S to Select & ├────────────┼────────────┼────────────┼────────────┤ ",0,1,15,twinp);
writewxy(" Unselect Files. │ │ │ │ │ ",0,1,16,twinp);
writewxy(" ├────────────┼────────────┼────────────┼────────────┤ ",0,1,17,twinp);
writewxy(" Selected/UnSelected │ │ │ │ │ ",0,1,18,twinp);
writewxy(" └────────────┴────────────┴────────────┴────────────┘ ",0,1,19,twinp);
writewxy(" ",0,1,20,twinp);
writewxy(" Press 'Y' or 'N' to select:-- Purge Deleted Records (Y/N) ",0,1,21,twinp);
writewxy(" ",0,1,22,twinp);
writewxy(" Press Esc to Abort or F10 to Continue. ",0,1,23,twinp);
attrwritewxy(69,75,5,5,twinp); attrwritewxy(69,75,5,6,twinp);
attrwritewxy(69,75,5,7,twinp); attrwritewxy(69,75,5,8,twinp);
attrwritewxy(53,31,22,11,twinp); attrwritewxy(53,31,22,12,twinp);
attrwritewxy(53,31,22,13,twinp); attrwritewxy(53,31,22,14,twinp);
attrwritewxy(53,31,22,15,twinp); attrwritewxy(53,31,22,16,twinp);
attrwritewxy(53,31,22,17,twinp); attrwritewxy(8,112,2,18,twinp);
attrwritewxy(10,31,11,18,twinp); attrwritewxy(53,31,22,18,twinp);
attrwritewxy(53,31,22,19,twinp); attrwritewxy(3,75,27,23,twinp);
attrwritewxy(3,75,43,23,twinp);
}
return(twinp);
}
winptr PrintMenuHelp(void)
/* Draw the Print Menu Module"s Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,9,3,64,20,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Print Menu Definition ├")) {
twinp = curwin;
writewxy(" You may print the menu definition either to the Printer or to ",0,1,1,twinp);
writewxy(" a Disk File, if the latter, then you will be prompted for a ",0,1,2,twinp);
writewxy(" file name in which the output will be stored. ",0,1,3,twinp);
writewxy(" ",0,1,4,twinp);
writewxy(" Next select how to handle extended ASCII characters, primarily ",0,1,5,twinp);
writewxy(" the extended 'line' characters. There are three options that ",0,1,6,twinp);
writewxy(" allow you to select a better output format if your printer ",0,1,7,twinp);
writewxy(" supports the extended ASCII characters. The choices are :-- ",0,1,8,twinp);
writewxy(" ",0,1,9,twinp);
writewxy(" 1. Simple ASCII - Characters with ordinal values from 32 to ",0,1,10,twinp);
writewxy(" 127 are printed as normal, the single and double line ",0,1,11,twinp);
writewxy(" characters are translated to |-+\x22=, all the rest are turned ",0,1,12,twinp);
writewxy(" into spaces. ",0,1,13,twinp);
writewxy(" ",0,1,14,twinp);
writewxy(" 2. Extended ASCII - Characters with ordinal values from 32 to ",0,1,15,twinp);
writewxy(" 255 are printed as they appear, characters with ordinal ",0,1,16,twinp);
writewxy(" values from 0 to 31 inclusive, (the control characters), ",0,1,17,twinp);
writewxy(" are turned into spaces. ",0,1,18,twinp);
writewxy(" ",0,1,19,twinp);
writewxy(" 3. Complete ASCII - All characters are output as they appear. ",0,1,20,twinp);
}
return(twinp);
}
winptr MakerHelp(void)
/* Draw Menu Maker"s Main Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,3,7,75,14,47,46,8,"─┐│┘─└│┌",TopLft,"┤ MenuMaker Options ├")) {
twinp = curwin;
writewxy(" You can do a number of things:- ",0,1,1,twinp);
writewxy(" Press F1 again to look at the on line manual OR ",0,1,2,twinp);
writewxy(" Press Esc(ape) to remove this help box AND ",0,1,3,twinp);
writewxy(" - Press F2 If you want to add a name to the menu e.g. You might want ",0,1,4,twinp);
writewxy(" to add a game to this menu OR ",0,1,5,twinp);
writewxy(" if you want to add a subsidiary menu e.g. You might want ",0,1,6,twinp);
writewxy(" to put all your games on to a 'Games Menu'. ",0,1,7,twinp);
writewxy(" - Press F3 If you want to delete a name from the menu OR ",0,1,8,twinp);
writewxy(" If you want to delete the menu (this is only allowed if ",0,1,9,twinp);
writewxy(" there are no names left in the menu). ",0,1,10,twinp);
writewxy(" - Press F4 If you want to change a name. ",0,1,11,twinp);
writewxy(" - Press F5 If you want to change the title on the screen. ",0,1,12,twinp);
writewxy(" - Press Esc If you want to go back a level of menu or if you are ",0,1,13,twinp);
writewxy(" finished making changes to your menu. ",0,1,14,twinp);
}
return(twinp);
}
winptr MakerAddHelp(void)
/* Draw Menu Maker"s "Add Item" Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,2,3,78,19,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Adding to a Menu ├")) {
twinp = curwin;
writewxy(" You are adding something to the menu. Tell the computer whether:- ",0,1,1,twinp);
writewxy(" - You want to add a (program) name to this menu (Perhaps you want to run ",0,1,2,twinp);
writewxy(" a game from this menu and have its name appear in this menu) OR ",0,1,3,twinp);
writewxy(" - You want to add a subsidiary menu (Perhaps you want to put all your ",0,1,4,twinp);
writewxy(" games on the one menu and have the menu name 'Games Menu' appear in ",0,1,5,twinp);
writewxy(" this menu). ",0,1,6,twinp);
writewxy(" ",0,1,7,twinp);
writewxy(" If you want to add a (program) name to this menu:- ",0,1,8,twinp);
writewxy(" - Press Esc to remove this help box from the screen AND press N (for Name). ",0,1,9,twinp);
writewxy(" ",0,1,10,twinp);
writewxy(" If you want to add a subsidiary menu:-- ",0,1,11,twinp);
writewxy(" - Press Esc to remove this help box AND press S (for Subsidiary Menu). ",0,1,12,twinp);
writewxy(" ",0,1,13,twinp);
writewxy(" If you select 'N' for Name then you will get to point at the name you want. ",0,1,14,twinp);
writewxy(" After this MenuMaker will prompt you 'Enter Any Parameters Now : '. If the ",0,1,15,twinp);
writewxy(" program you have chosen needs parameters you may enter them here, or you can ",0,1,16,twinp);
writewxy(" leave this section blank by pressing <Enter> straight away. ",0,1,17,twinp);
writewxy(" ",0,1,18,twinp);
writewxy(" If you are still unsure and you want the on-line manual - Press F1 again. ",0,1,19,twinp);
}
return(twinp);
}
winptr MakerNameHelp(void)
/* Draw Menu Maker"s "Name Item" Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,2,3,78,21,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Typing the name ├")) {
twinp = curwin;
writewxy(" You are being asked to type a name for the program or sub-menu. If you are ",0,1,1,twinp);
writewxy(" typing the name of a sub-menu, what you type will appear in this menu and ",0,1,2,twinp);
writewxy(" also as a title on the sub-menu as well. ",0,1,3,twinp);
writewxy(" When you are typing the name, if you:- ",0,1,4,twinp);
writewxy(" Press the Del(ete) key You will delete the character which has the cursor ",0,1,5,twinp);
writewxy(" on it. ",0,1,6,twinp);
writewxy(" Press the Ins(ert) key You will turn 'Insert Mode' on. When 'Insert Mode' ",0,1,7,twinp);
writewxy(" is on, the cursor turns into a flashing rectangle ",0,1,8,twinp);
writewxy(" and you can add characters into the name. To turn ",0,1,9,twinp);
writewxy(" 'Insert Mode' off, press the Ins(ert) key again. ",0,1,10,twinp);
writewxy(" Press the Home key The cursor will go to the start of the name. ",0,1,11,twinp);
writewxy(" Press the End key The cursor will go to the end of the name. ",0,1,12,twinp);
writewxy(" Press the Left arrow The cursor will go one character to the left. ",0,1,13,twinp);
writewxy(" Press the Right arrow The cursor will go one character to the right. ",0,1,14,twinp);
writewxy(" Press the (Esc)ape key The (program)name/(Sub-menu)name will not be added. ",0,1,15,twinp);
writewxy(" Press the Enter Key The name, as it appears, will be accepted. ",0,1,16,twinp);
writewxy(" ",0,1,17,twinp);
writewxy(" If you are still unsure, read your manual AND/OR Press F1 to see the on-line ",0,1,18,twinp);
writewxy(" manual. ",0,1,19,twinp);
writewxy(" ",0,1,20,twinp);
writewxy(" Press the Esc(ape) key to remove this help box from the screen. ",0,1,21,twinp);
}
return(twinp);
}
winptr MakerDelHelp(void)
/* Draw Menu Maker"s "Delete Item" Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,3,4,76,18,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Deleting from the menu ├")) {
twinp = curwin;
writewxy(" Warning - If you continue you will erase something. ",0,1,1,twinp);
writewxy(" ",0,1,2,twinp);
writewxy(" If there is a name in the menu which has the highlight bar on it, and you ",0,1,3,twinp);
writewxy(" continue, you will erase that name and you will not be able to run that ",0,1,4,twinp);
writewxy(" program. ",0,1,5,twinp);
writewxy(" ",0,1,6,twinp);
writewxy(" If there are no names in the menu, and you continue, you will erase the ",0,1,7,twinp);
writewxy(" menu and erase its name from the previous menu. ",0,1,8,twinp);
writewxy(" ",0,1,9,twinp);
writewxy(" If you do not want to erase the name or the menu, Press Esc(ape) to remove ",0,1,10,twinp);
writewxy(" this help box from the screen and Press N for No. ",0,1,11,twinp);
writewxy(" ",0,1,12,twinp);
writewxy(" If you want to erase the name or the menu, Press Esc(ape) to remove this ",0,1,13,twinp);
writewxy(" help box from the screen and Press Y for Yes. ",0,1,14,twinp);
writewxy(" ",0,1,15,twinp);
writewxy(" If you are still unsure, read your manual AND/OR Press F1 to look at the ",0,1,16,twinp);
writewxy(" on-line manual. ",0,1,17,twinp);
writewxy(" ",0,1,18,twinp);
}
return(twinp);
}
winptr MakerTitleHelp(void)
/* Draw Menu Maker"s "Menu Title" Help Window */
{
winptr twinp;
twinp = NULL;
if (openwin(0,2,3,78,20,47,46,8,"─┐│┘─└│┌",TopLft,"┤ Changing the title ├")) {
twinp = curwin;
writewxy(" You have chosen to alter the title shown at the top of the screen. ",0,1,1,twinp);
writewxy(" ",0,1,2,twinp);
writewxy(" When you are typing the title, If you:- ",0,1,3,twinp);
writewxy(" Press the Del(ete) key You will delete the character which has the cursor ",0,1,4,twinp);
writewxy(" on it. ",0,1,5,twinp);
writewxy(" Press the Ins(ert) key You will turn 'Insert Mode' on. When 'Insert Mode' ",0,1,6,twinp);
writewxy(" is on, the cursor turns into a flashing rectangle ",0,1,7,twinp);
writewxy(" and you can add characters into the title. To turn ",0,1,8,twinp);
writewxy(" 'Insert Mode' off, press the Ins(ert) key again. ",0,1,9,twinp);
writewxy(" Press the Home key The cursor will go to the start of the title. ",0,1,10,twinp);
writewxy(" Press the End key The cursor will go to the end of the title. ",0,1,11,twinp);
writewxy(" Press the Left arrow The cursor will go one character to the left. ",0,1,12,twinp);
writewxy(" Press the Right arrow The cursor will go one character to the right. ",0,1,13,twinp);
writewxy(" Press the (Esc)ape key The Title will not be altered. ",0,1,14,twinp);
writewxy(" Press the Enter Key The Title, as it appears, will be accepted. ",0,1,15,twinp);
writewxy(" ",0,1,16,twinp);
writewxy(" If you are still unsure, read your manual AND/OR Press F1 to see the on-line ",0,1,17,twinp);
writewxy(" manual. ",0,1,18,twinp);
writewxy(" ",0,1,19,twinp);
writewxy(" Press the Esc(ape) key to remove this help box from the screen. ",0,1,20,twinp);
}
return(twinp);
}
winptr ChooseHelpWin(void)
{
winptr twinp;
twinp = NULL;
if (openwin(0,20,10,40,6,47,46,8,"─┐│┘─└│┌",TopCnt,"─ Choose Help ─")) {
twinp = curwin;
writewxy(" Select one of the choices listed in ",0,1,1,twinp);
writewxy(" the choose box, by either moving the ",0,1,2,twinp);
writewxy(" highlight bar over the required choice ",0,1,3,twinp);
writewxy(" and pressing enter, or pressing the ",0,1,4,twinp);
writewxy(" character that corresponds to the ",0,1,5,twinp);
writewxy(" first letter of the required choice. ",0,1,6,twinp);
}
return(twinp);
}
/********************** UNIT INITIALIZATION/EXIT CODE *********************/
void db_uwin_init(void)
{
if (!initialized) {
initialized = True;
db_key_init();
}
}